import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '@/views/user/Login.vue'
import Home from '@/views/home/Home.vue'


const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: "/home",
    },
    {
      path: '/home',
      component: Home,
      children: [
        {
          path: '/updatePassword',
          // 路由的懒加载
          component: () => import("@/views/user/UpdatePassword.vue")
        },
        {
          path: '/adminInfo',
          component: () => import("@/views/adminInfo/AdminInfo.vue")
        },
        {
          path: '/resident',
          component: () => import("@/views/resident/Resident.vue")
        },
        {
          path: '/doctor',
          component: () => import("@/views/doctor/Doctor.vue")
        },
        {
          path: '/admin',
          component: () => import("@/views/admin/Admin.vue")
        },
        {
          path: '/healthInstitution',
          component: () => import("@/views/healthInstitution/HealthInstitution.vue")
        },
        {
          path: '/medication',
          component: () => import("@/views/medication/Medication.vue")
        },
        {
          path: '/appointment',
          component: () => import("@/views/appointment/Appointment.vue")
        },
        {
          path: '/appointmentDoctor',
          component: () => import("@/views/appointment/AppointmentDoctor.vue")
        },
        {
          path: '/healthRecord/:id',
          component: () => import("@/views/healthRecord/HealthRecord.vue")
        },
        {
          path: '/healthRecord',
          component: () => import("@/views/healthRecord/HealthRecord.vue")
        },
        {
          path: '/roleManage',
          component: () => import("@/views/permissions/RoleManage.vue")
        },
        {
          path: "/permission/:id",
          component: () => import("@/views/permissions/Permission.vue")
        },
        {
          path: '/title',
          component: () => import("@/views/title/Title.vue")
        },
        {
          path: '/department',
          component: () => import("@/views/department/Department.vue")
        },
        {
          path: '/medicalDevice',
          component: () => import("@/views/medicalDevice/MedicalDevice.vue")
        },
        {
          path: "/institutionMedication/:id",
          component: () => import("@/views/healthInstitution/InstitutionMedication.vue")
        },
        {
          path: '/institutionType',
          component: () => import("@/views/institutionType/InstitutionType.vue")
        },
        {
          path: '/prescription/:id',
          component: () => import("@/views/prescription/Prescription.vue")
        },
        {
          path: '/medication/:id',
          component: () => import("@/views/medication/Medication.vue")
        },
        {
          path: "/institutionDevice/:id",
          component: () => import("@/views/healthInstitution/InstitutionDevice.vue")
        },
        {
          path: '/announcement',
          component: () => import("@/views/announcement/Announcement.vue")
        },
        {
          path: '/opinion',
          component: () => import("@/views/opinion/Opinion.vue")
        },
        {
          path: '/evaluate',
          component: () => import("@/views/evaluate/Evaluate.vue")
        }
      ]
    },
    {
      path: '/login',
      component: Login
    }
  ]
})

export default router
